﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Net;

namespace design
{
    public partial class About : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Label4.Visible = false;
                SmtpClient Smtp = new SmtpClient("smtp.gmail.com", 25);
                Smtp.Credentials = new NetworkCredential("psihItStep@gmail.com", "16122012");
                MailMessage Message = new MailMessage();

                Message.From = new MailAddress(TextBox2.Text);
                Message.To.Add(new MailAddress("psihItStep@gmail.com"));
                Message.Subject = "Психология (сайт): Письмо от " + TextBox1.Text;
                Message.Body = "E-mail: " + TextBox2.Text + "\n" + TextBox3.Text;
                Smtp.EnableSsl = true;
                Smtp.Send(Message);
                this.Response.Redirect(this.Request.Url.ToString());
            }
            catch (System.Exception)
            {
                Label4.Visible = true;
            }

        }
    }
}